/**
 * zmn产品模块-产品列表
 * @author tanghongjun
 * @since 2018/10/18
 */
layui.define(['index', 'form', 'table', 'laypage', 'layedit', 'laydate',"tableMerge"], function (exports) {
    var $ = layui.$;
    var form = layui.form;
    var layer = layui.layer;
    var table = layui.table;
    var laypage = layui.laypage;
    var layedit = layui.layedit;
    var laydate = layui.laydate;
    let tableMerge = layui.tableMerge;

    table.init('zmn-table', {
        page: false,
        limit: 100000,
        defaultToolbar: [],
        toolbar: "#zmn-table-tool",
        done: function () {
            tableMerge.render(this)
        }
    });
    // 删除
    table.on("toolbar(zmn-table)", function (obj) {
        if (obj.event != "del") {
            return;
        }
        if (ids.length === 0) {
            return layer.alert("请选择至少1条数据！");
        }
        layer.confirm('确定删除吗？', function () {
            zmnPage.ajaxSimple("/tariffProduct/relation/deleteRelations.action", {ids: ids.join(","), tariffProductId: json.tariffProductId}, 1000);
        });
    });

    let ids = new Array();

    // 选择（全选或单选）
    table.on("checkbox(zmn-table)", function (obj) {
        ids = table.checkStatus('zmn-table').data.map((item) => item.id);
    });
    //对外暴露的接口
    exports('product_relation_tariff_js', {});
});
